/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package doan2database;

import java.util.ArrayList;

/**
 *
 * @author DongVan
 */
public class InsertDatabaseCode {
    
    
    
    
    
    ///
    public static void main(String args[]) {
        
          NguoiDung nd = new NguoiDung();
          TuyenTau tt = new TuyenTau();
          //Ve v = new Ve();
          //Insert nguoi dung
       
//        nd.setM_Password("123456");
//        nd.setM_TenND("Do Dong Van");
//        nd.setM_CMND("215144027");
//        nd.setM_SoDT("0989829970");
//        nd.setM_PublicKey("ThisIsPublicKey");
//        nd.setM_LoaiND(51);
//        nd.setM_UserName("dongvan");
//        boolean result = nd.insert();
        
          ///Insert Tuyen Tau
//          tt.setM_DiaDiemDi("Tp HCM");
//          tt.setM_DiaDiemDen("Ha Noi");
//          tt.setM_GioDi("07:30:00");
//          tt.setM_GioDen("12:20:00");
//          tt.setM_GiaVe("1500000");
//          tt.setM_NguoiLap(1);
//          boolean result = tt.insert();
//          System.out.println(result);
        
          
          //Insert Ve theo tuyen tau
//          for(int i = 0; i < 10; i++){
//            Ve v = new Ve();
//            v.setM_IDTuyen(1);
//            v.setM_NgayDi("25-07-2014");
//            v.setM_TinhTrang(0);
//            boolean result = v.insert();
//            System.out.println(result);
//          }
          
        //Select from nguoi dung
//        ArrayList<NguoiDung> listND = new ArrayList<NguoiDung>();
//        listND = nd.selected();
//        
//       for(NguoiDung item : listND){
//           System.out.println("ID nguoi dung: "+item.getM_IDNguoiDung());
//           System.out.println("User name: "+item.getM_UserName());
//           System.out.println("password: "+item.getM_Password());
//           System.out.println("Ten nguoi dung: "+item.getM_TenND());
//           System.out.println("so dien thoai: "+item.getM_SoDT());
//           System.out.println("CMND: "+item.getM_CMND());
//           System.out.println("Public key: "+item.getM_PublicKey());
//           System.out.println("ID loai nguoi dung: "+item.getM_LoaiND());
//       }
          
          
          
          
          //Select Tuyen Tau - Ve goi ve phia client
          TuyenTau_Ve ttv = new TuyenTau_Ve();
          ArrayList<TuyenTau_Ve> listClient = new ArrayList<>();
          listClient = ttv.selected(1, "07:30:00");
          
          for(TuyenTau_Ve i : listClient){
              System.out.println("Tuyen tau: " + i.getM_IDTuyenTau());
              System.out.println("Dia diem di: " + i.getM_DiaDiemDi());
              System.out.println("Dia diem den: " + i.getM_DiaDiemDen());
              System.out.println("Gio di : " + i.getM_GioDi());
              System.out.println("Gio den: " + i.getM_GioDen());
              System.out.println("Gia ve: " + i.getM_GiaVe());
              System.out.println("Ma ve: " + i.getM_IDVe());
              System.out.println("Ngay di: " + i.getM_NgayDi());
              System.out.println("----------------------------------- ");
          }
          
          
          
       return;
        
    }
}
